<%@ page import="com.zhangliang.oa.bean.Dept" %>
<%@ page import="java.util.List" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: z9413
  Date: 2022/3/15
  Time: 13:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>list</title>
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
    <script type='text/javascript'>
        function del(dno) {
            if (window.confirm('确认删除?')) {
                document.location.href = '${pageContext.request.contextPath}/dept/del?deptno=' + dno;
            }
        }
    </script>
</head>
<body>
<h3>欢迎，累计在线<%=application.getAttribute("onlineCount")%>人</h3>
<h1 align='center'>部门列表</h1>
<a href="dept/exit">退出系统</a>
<hr>
<table border='1px' width='50%' align='center'>
    <tr>
        <th>部门编号</th>
        <th>部门名称</th>
        <th>工作地点</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${dept}" var="d">
        <tr align='center'>
            <td>${d.deptno}</td>
            <td>${d.dname}</td>
            <td>${d.loc}</td>
            <td>
                <a href='javascript:(0)' onclick='del(${d.deptno})'>删除</a>
                <a href='dept/select?b=x&deptno=${d.deptno}'>修改</a>
                <a href='dept/select?b=c&deptno=${d.deptno}'>查询</a>
            </td>
        </tr>
    </c:forEach>
</table>
<a href='add.jsp'>新增部门</a>
</body>
</html>
